﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace passitumi
{
	/**
	 * This class is used to manage the events of peers being discovered
	 * and lost. The events are passed from the middle-level (ServiceLocator)
	 * to the upper-level (Gui), which is where the event is handled.
	 */
	public class ServiceEventArgs : EventArgs
	{
		// Constants to describe events that occur
		public const string PEER_FOUND = "Peer Found";
		public const string PEER_REMOVED = "Peer Removed";
		public const string ERROR = "Error";

		// Variables which compose the event to be passed
		public string eventType;
		public string displayName;

		/**
		 * A constructor for creating an event when a peer is added or removed. If the event 
		 * is not correctly called then the an error event is passed.
		 */
		public ServiceEventArgs(string eventType, string displayName)
		{
            if (eventType.Equals(ServiceEventArgs.PEER_FOUND) || eventType.Equals(ServiceEventArgs.PEER_REMOVED))
			{
				this.eventType = eventType;
				this.displayName = displayName;
			}
			else
			{
				this.eventType = ServiceEventArgs.ERROR;
			}
		}
	}
}
